package nl.bluemango.mangotimer.vo
{
	import mx.collections.ArrayCollection;
	
	[Bindable]
	[Table (name="project")]
	public class Project{
		[Id]
		public var id:int;
		[Column(name="number")]
		public var number:int;
		[Column(name="name")]
		public var name:String;
		[Column(name="client")]
		public var client:String;
		[Column(name="is_billable")]
		public var isBillable:Boolean;
		[Column(name="time")]
		public var time:int;
		[Column(name="is_physical")]
		public var isPhysical:Boolean;
		
		[OneToOne( type="nl.bluemango.mangotimer.vo.Cluster", lazy="false", cascade="all" )]
		public var clusters:ArrayCollection = new ArrayCollection()
			
		public function getTimeInHours():String{
			var str:String = "000:00"
			var t:int = time;
			var h:int = Math.floor(t/(1000*60*60));
			var m:int = Math.floor(t%(1000*60*60)/(1000*60));
			return h+":"+m
		}
	}
}